Repository navigation
feat(plugin-api): workspace/recentProjects.importEntries 供迁移插件并入最近项目 - #269
Draft
David-on-Code wants to merge 3 commits into
Draft
David-on-Code wants to merge 3 commits into
David-on-Code wants to merge 3 commits into
Conversation
API-05 领域内新增宿主方法,不升版:后端把 1-1024 条 {path, lastOpenedAt}
并入宿主最近项目列表,已列出路径保留较新时间,回答 {added, removed}。
新增权限 workspace.recentProjects.import(单独方法授权,需 backend)。
合并/容量/持久化复用宿主既有历史链路;Core 只做参数校验与路由。
契约 README、fixture、API 总表中英、专题页、协议登记与四语 SDK 同步。
复用既有错误码,不新增;经 getCapabilities 发现,旧宿主 unavailable。
24 of 25 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue
PINNED_CORE_REVISION升到包含本改动的 commit)PR 类型
feat:新增公共插件宿主方法(API-05 领域内扩展,不升版)
用户流程与缺口
迁移类插件(IDEA、VS Code 等最近项目导入)需要把规范化的项目条目并入宿主最近项目列表。现有 API 调查:
listContexts/getContext/getFolders/getHostPaths/setDirectoryTypes/setDirectoryMarks只读上下文或目录标记,无最近项目写入。workspace.recentProjects.reduce的importEntries合并逻辑已在 Core(projectcrate),但只对宿主开放,插件无调用通道。litheKeymapImport是读取中介协议,不解决"写入宿主列表"。缺口:插件没有把带时间的项目条目并入宿主最近项目列表的公共方法。
公共接口如何供第二个语义不同的工具使用
方法只接受
{path, lastOpenedAt}规范化条目,不认识来源工具。IDEA 插件解析recentProjects.xml,VS Code 插件解析其最近工作区记录,其他 JetBrains 产品同理——各自在插件内完成格式解析、目录发现与路径宏展开,调用同一方法。宿主与 Core 无工具名分支、无工具专属字段。工具特有知识留在哪里
来源格式解析、配置目录发现、
$USER_HOME$等宏展开、死路径过滤全部在插件后端。Core 只做参数校验与路由;宿主只做合并、持久化与发布(复用既有importEntriesreducer 与历史存储)。新增方法、权限与生命周期
lithe/host/workspace/recentProjects.importEntriesworkspace.recentProjects.import,单独的方法授权,不随workspace服务授予;需要backend声明(既有通用检查)。entries为 1–1024 个恰好含path(非空、≤4096 UTF-8 字节、无 NUL 的绝对本地路径)与lastOpenedAt(非负 Unix 毫秒整数)的对象;整个请求另受hostRequestBytes(1 MiB)约束。{added, removed}路径列表;不返回其余历史。plugin.host.failed,保留原列表。版本变化
pluginAPIVersion、清单schemaVersion、能力版本、进程协议版本、公共文档格式版本:均无变化。getCapabilities发现。新旧兼容组合
plugin.permission.unknown拒绝未知权限;无处理器的宿主getCapabilities不列出该方法,调用得plugin.host.unavailable(-32601)首次支持的 Core commit:本 PR;宿主 PR/发布版本:待接线;插件发布顺序:宿主稳定发布后插件才进市场,此前仅预发布。
契约与消费者同步
Workspace contexts and capability discovery方法表新增行与规则块。backend/recent-projects-import.plugin.json(清单);backend/function-protocol.jsonhostRequests新增 12 个转发/授权/拒绝用例。reference/domains/recent-projects.md(中英);协议更新记录"待合入"与"宿主方法(按 API 编号)"索引。Workspace::import_recent_projects+RecentProjectEntry/RecentProjectsImport;GoWorkspace.ImportRecentProjects;Nodeworkspace.importRecentProjects+index.d.ts;JavaWorkspace.importRecentProjects+ 两个类型。各 SDK README 方法表新增行。统一日志
复用既有机制,不新增目录事件:Core 请求分发处的执行轨迹记录本方法的终态(用户来源成功 INFO、失败 WARN);宿主执行失败经既有
app.notification.operation_failed边界记录。参数校验拒绝在 Core 请求轨迹内可见(稳定码 + 方法名)。不记录路径列表内容;错误字段经共享脱敏。错误码
全部复用,无新增:
plugin.host.unsupportedOption(-32018,未知顶层选项,details.option)、plugin.host.invalidParams(-32602)、plugin.host.permissionDenied(-32010)、plugin.host.unavailable(-32601)、plugin.host.failed(-32603)、安装期plugin.permission.unknown。全契约查重:未占用新编号,未改旧码含义。验证(实际执行)
cargo test -p lithe-plugin-rpc -p lithe-core -p lithe-plugin-manifestcargo test -p lithe-plugin-sdk(Rust SDK)go test ./lithe(Go SDK)node --test test/host.test.mjs(Node SDK)mvn -pl plugin-sdk test -Dtest=HostTest(Java SDK,JDK 17 跑 release 8)node shared/plugins/scripts/verify-docs.mjsnode scripts/rust-core/verify-platform-tests.mjsscripts/rust-core/verify-rust-core-comments.sh plugin-rpc corecargo fmt --check(受影响 crate)cargo clippy -p lithe-plugin-rpc -p lithe-core -p lithe-plugin-manifest --all-targetsnode shared/plugins/scripts/sdk-e2e.mjsZSTD_SYS_USE_PKG_CONFIG=1等,同 CI)未执行的检查及原因: macOS/Windows runner 检查在 PR ready 后由 CI 运行;桌面端接线与真实插件端到端在宿主 PR 与插件仓库验证。